package com.zxx.pattern.mementoPattern.memento2_game;

/**
 * @author zxx on 2021/3/16
 */
public class TestClient {

    public static void main(String[] args) {
        //打boss前，状态全满
        Role role = new Role(100, 100);
        role.display();

        //保存进度
        Caretaker caretaker = new Caretaker();
        //没有用set 是因为变量不是private
        caretaker.memento = role.saveMemento();//只能保存一次

        //快game over
        role.setBloodFlow(20);
        role.setMagicPoint(20);
        role.display();

        //恢复存档
        role.restoreMemento(caretaker.getMemento());
        role.display();

        Memento memento = new Memento(200, 200);
        role.restoreMemento(memento);
        role.display();

    }

}
